package com.acsior.hibernate.vo;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.acsior.dac.impl.hibernate.vo.GeneratorKey;

/**
 * PoboxService entity. @author MyEclipse Persistence Tools <b><i>powered by
 * Belev</i></b>
 */
@Entity
@Table(name = "pobox_services")
@GeneratorKey(tableName = "service_requests")
public class PoboxServiceVO extends ServiceRequestVO {

	private static final long serialVersionUID = -2922288304383943950L;

	@Column(name = "advertisement", nullable = false)
	private boolean advertisement;

	@Column(name = "application_number", nullable = false, length = 50)
	private String applicationNumber;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "customer_id", nullable = false)
	private CustomerVO customer;

	@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	@JoinTable(name = "pobox_services_customers", joinColumns = { @JoinColumn(name = "pobox_service_id", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "customer_id", nullable = false, updatable = false) })
	private List<CustomerVO> customers;

	@Temporal(TemporalType.DATE)
	@Column(name = "date_from", nullable = false, length = 10)
	private Date dateFrom;

	@Temporal(TemporalType.DATE)
	@Column(name = "date_to", nullable = false, length = 10)
	private Date dateTo;

	@Column(name = "key_given", nullable = false)
	private boolean keyGiven;

	@Temporal(TemporalType.DATE)
	@Column(name = "key_return_date", length = 10)
	private Date keyReturnDate;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "pobox_id", nullable = false)
	private PoboxVO pobox;

	@Column(name = "receipt_number", nullable = false, length = 50)
	private String receiptNumber;

	/** default constructor */
	public PoboxServiceVO() {
		this.customers = new ArrayList<CustomerVO>();
	}

	/** @return the applicationNumber */
	public String getApplicationNumber() {
		return this.applicationNumber;
	}

	/** @return the customer */
	public CustomerVO getCustomer() {
		return this.customer;
	}

	/** @return the customers */
	public List<CustomerVO> getCustomers() {
		return this.customers;
	}

	/** @return the dateFrom */
	public Date getDateFrom() {
		return this.dateFrom;
	}

	/** @return the dateTo */
	public Date getDateTo() {
		return this.dateTo;
	}

	/** @return the keyReturnDate */
	public Date getKeyReturnDate() {
		return this.keyReturnDate;
	}

	/** @return the pobox */
	public PoboxVO getPobox() {
		return this.pobox;
	}

	/** @return the receiptNumber */
	public String getReceiptNumber() {
		return this.receiptNumber;
	}

	/** @return the advertisement */
	public boolean isAdvertisement() {
		return this.advertisement;
	}

	/** @return the keyGiven */
	public boolean isKeyGiven() {
		return this.keyGiven;
	}

	/**
	 * @param advertisement
	 *            the advertisement to set
	 */
	public void setAdvertisement(boolean advertisement) {
		this.advertisement = advertisement;
	}

	/**
	 * @param applicationNumber
	 *            the applicationNumber to set
	 */
	public void setApplicationNumber(String applicationNumber) {
		this.applicationNumber = applicationNumber;
	}

	/**
	 * @param customer
	 *            the customer to set
	 */
	public void setCustomer(CustomerVO customer) {
		this.customer = customer;
	}

	/**
	 * @param customers
	 *            the customers to set
	 */
	public void setCustomers(List<CustomerVO> customers) {
		this.customers = customers;
	}

	/**
	 * @param dateFrom
	 *            the dateFrom to set
	 */
	public void setDateFrom(Date dateFrom) {
		this.dateFrom = dateFrom;
	}

	/**
	 * @param dateTo
	 *            the dateTo to set
	 */
	public void setDateTo(Date dateTo) {
		this.dateTo = dateTo;
	}

	/**
	 * @param keyGiven
	 *            the keyGiven to set
	 */
	public void setKeyGiven(boolean keyGiven) {
		this.keyGiven = keyGiven;
	}

	/**
	 * @param keyReturnDate
	 *            the keyReturnDate to set
	 */
	public void setKeyReturnDate(Date keyReturnDate) {
		this.keyReturnDate = keyReturnDate;
	}

	/**
	 * @param pobox
	 *            the pobox to set
	 */
	public void setPobox(PoboxVO pobox) {
		this.pobox = pobox;
	}

	/**
	 * @param receiptNumber
	 *            the receiptNumber to set
	 */
	public void setReceiptNumber(String receiptNumber) {
		this.receiptNumber = receiptNumber;
	}

}